/*
   Copyright 2009 Bégaudeau Stéphane

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

package faneclipse.views;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;

/**
 * @author BEGAUDEAU stephane
 */
public class TreeObject implements IAdaptable {
	/**
	 * The name of the tree object.
	 */
	private String name;
	
	/**
	 * the parent of the object.
	 */
	private TreeParent parent;
	
	/**
	 * The associated resource.
	 */
	private IResource resource;
	
	/**
	 * The constructor.
	 * @param name the name of the element.
	 */
	public TreeObject(final String name) {
		this.name = name;
	}

	/**
	 * @return the name.
	 */
	public final String getName() {
		return name;
	}

	/**
	 * @param parent the new parent.
	 */
	public final void setParent(final TreeParent parent) {
		this.parent = parent;
	}
	
	/**
	 * @param arg0 The class to adapt.
	 * @return The adapter.
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
	 */
	@SuppressWarnings("unchecked")
	public final Object getAdapter(final Class arg0) {
		return null;
	}

	/**
	 * @return the parent.
	 */
	public final TreeParent getParent() {
		return parent;
	}

	/**
	 * @return A string representing the object.
	 * @see java.lang.Object#toString()
	 */
	public final String toString() {
		return getName();
	}
	
	/**
	 * @return the resource.
	 */
	protected final IResource getResource() {
		return resource;
	}
	
	/**
	 * @param resource the new resource.
	 */
	protected final void setResource(final IResource resource) {
		this.resource = resource;
	}
	
}
